package com.ygqh.baby.service;

import java.util.Date;
import java.util.List;
import java.util.Map;

import com.ygqh.baby.ao.QueryInfo;
import com.ygqh.baby.ao.ResultSet;
import com.ygqh.baby.model.AdminPurchaseDetailInCount;
import com.ygqh.baby.model.wdt.WdtInStockOrder;
import com.ygqh.baby.po.AdminContractArrive;
import com.ygqh.baby.po.AdminPurchase;
import com.ygqh.baby.po.WdtQybStockIn;

public interface AdminPurchaseService {

	List<AdminPurchase> find();

	int findCount();

	AdminPurchase findById(Long id);

	int deleteSoft(Long[] ids);

	int deleteSoft(Long id);

	int save(AdminPurchase adminPurchase);

	int update(AdminPurchase adminPurchase);

	int saveOrUpdate(AdminPurchase adminPurchase);

	ResultSet<AdminPurchase> search(QueryInfo queryInfo, String q, Date startDate, Date endDate, String purchaseCode,String contractCode);

	AdminPurchase findPurchaseByCode(String purchaseCode);

	ResultSet<AdminContractArrive> searchContractArrive(QueryInfo queryInfo, String skuCode, String supplierName, String contractCode, Date startDate,
			Date endDate);

	List<Map<String, Object>> selectPruchaseDetailBySku(String skuCode, String contractCode);

	/**
	 * 查询没有结算的进货单
	 * 
	 * @param contractCode
	 * @return
	 */
	List<AdminPurchase> selectPurchaseByContractCode(String contractCode);

	int writeBackWdtPurchaseCode(String purchaseCode, String erpOrderCode);

	/**
	 * 更新admin_purchase 表的 in_stock_time,in_stock_amount,in_stock_price
	 * 和admin_purchase_detail 表中的in_amount
	 * 
	 * @param item
	 * @return
	 */
	int writeBackStorageStatus(WdtInStockOrder item);

	/**
	 * 更新admin_purchase 表的 in_stock_time,in_stock_amount,in_stock_price
	 * 和admin_purchase_detail 表中的in_amount
	 * 
	 * @param item
	 * @return
	 */
	int writeBackStorageStatus(WdtQybStockIn item);

	/**
	 * 根据旺店通code获取采购单
	 * 
	 * @param wdtPurchaseCode
	 * @return
	 */
	AdminPurchase findByWdtPurchaseCode(String wdtPurchaseCode);

	int updateLogicCode(AdminPurchase purchase);

	List<AdminPurchaseDetailInCount> findPurchaseDetailInStockCountByContractCode(String contractCode);
	List<AdminContractArrive> selectContractArrive(QueryInfo queryInfo,
			String skuCode, String supplierName, String contractCode,
			Date startDate, Date endDate);
	/**
	 * 查询入库数据
	 * @param q
	 * @param purchaseCode
	 * @return
	 */
	List<AdminPurchase> searchPurchase(String q, String purchaseCode);

}
